package jgrouse.jgdoc.api;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public interface ILink extends IContentSection
{
	public static final Set<String> EXTERNAL_LINK_PREFIXES = new HashSet<String>(Arrays.asList("http://", "https://", "/"));

	public String getLink();

	public String getResolvedPath();
	public void setResolvedPath(String pResolvedPath);
	public IComment getComment();
	public boolean isExternal();
	public void setExternal(boolean external);
	
	public static class Util {
		private Util(){};
		
		public static boolean isExternalLink(String ref) {
			for (String prefix : ILink.EXTERNAL_LINK_PREFIXES) {
				if (ref.startsWith(prefix)) {
					return true;
				}
			}
			return false;
		}
	}

}